package org.jspar.partition;

import org.jspar.Options;

/**
 * VARIANT 1:  A partition is acceptable if it has LE the preset number
 * of connections (-c flag) AND it has LE the preset number of modules
 * enclosed (-s flag).
 */
public class SizeBasedRule extends PartitionRule {

	public SizeBasedRule(Options options) {
		super(options);
	}

	public boolean isAcceptable(Cluster ci, Cluster cj, int c) {
		int s = ci.size() + cj.size();

		return s <= configuration.maxPartitionSize
				&& c <= configuration.maxPartitionConn;
	}
}
